package powtorka.serializacja;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

public class ReadObject {

	public static void main(String[] args) {

		Address address;

		try {
			ObjectInputStream is = new ObjectInputStream(new FileInputStream(
					new File("addressFile.ser")));
			address = (Address) is.readObject();
			System.out.println(address.toString());
			is.close();
			System.out.println("Done");
		} catch (FileNotFoundException e) {
			System.out.println("Nie odnaleziono pliku.");
		} catch (IOException e) {
			System.out.println("IOEx");
		} catch (ClassNotFoundException e) {
			System.out.println("ClassNF");
		}
	}

}
